<template>
	<view class="body">
		<view class="headBox">
			<view class="priceText">总收入(元)</view>
			<view class="price">{{total}}</view>
			<view class="showToast">
				<view>如何领取</view>
				<uni-icon type="question-o" size="17" color="rgba(255,255,255,0.8)"></uni-icon>
			</view>
		</view>
		<view class="content">
			<view class="title">收入记录</view>
			<view class="item" v-for="(item, index) in myincomeList" :key="index">
				<view class="left">
					<view class="time">{{item.create_time}}</view>
					<view>订单编号: {{item.ordersn}}</view>
				</view>
				<view class="right">+{{item.commission}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import uniIcon from "@/components/uni-icon/uni-icon.vue";
	import {dns} from "@/pages/dns.js";
	export default {
		data(){
			return {
				total: 0,
				myincomeList: []
			}
		},
		components: {
			uniIcon
		},
		onLoad() {
			this.getmyincome();
		},
		methods:{
			getmyincome(){//获取我的收入
				uni.request({
					method:'GET',
					header:{
						token: uni.getStorageSync('token')
					},
					url: dns + 'commission/list',
					success: (res)=>{
						console.log(res)
						if(res.data.status == 1){
							this.total = res.data.total;
							this.myincomeList = res.data.data;
						}
						if(res.data.status == -1){
							uni.showToast({
								icon: 'none',
								title: res.data.msg
							})
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.headBox{
		height: 300upx;
		background-color: #ff5c5d;
		color: #fff;
		padding-top: 30upx;
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		.priceText{
			font-size: 24upx;
			text-align: center;
			margin-bottom: 20upx;
			color: rgba(255,255,255,0.8);
		}
		.price{
			text-align: center;
			font-size: 90upx;
		}
		.showToast{
			font-size: 24upx;
			display: flex;
			justify-content: center;
			view{
				line-height: 42upx;
				color: rgba(255,255,255,0.8);
			}
		}
	}
	.content{
		padding-top: 350upx;
		.title{
			line-height: 80upx;
			font-size: 34upx;
			background-color: #fff;
			text-align: center;
			margin-bottom: 30upx;
		}
		.title::after{
			content: '';
			display: block;
			height: 4upx;
			width: 60upx;
			margin: 0 auto;
			margin-top: -4upx;
			background-color: #ff5c5d;
		}
		.item{
			background-color: #fff;
			display: flex;
			justify-content: space-between;
			padding: 10upx 30upx ;
			font-size: 28upx;
			border-bottom: 1upx solid #eee;
			.right{
				line-height: 76upx;
			}
		}
	}
</style>
